package com.cookman.assets;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Sprite;

/**
 * Created by Cookman on 06.02.2015.
 */
public class AssetsLocator {

    private static Assets assets;

    public static void provideAssets(Assets _assets) {
        assets = _assets;
    }

    public static Assets getAssets() {
        return assets;
    }

    public static boolean hasSprite(String group, String key){
        try {
            if(assets.getSpriteByAtlasRegion(group, key)!=null){
                return true;
            }
        } catch (Exception e) {
            Gdx.app.error("AssetsLocator", e.getMessage());
        }
        return false;
    }

    public static Sprite getSpriteByAtlasRegion(String group, String key) {
        try {
            return assets.getSpriteByAtlasRegion(group, key);
        } catch (Exception e) {
            Gdx.app.error("AssetsLocator", e.getMessage());
        }
        return new Sprite();
    }
}
